package cwb1;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

public class ArrayListMap<E> extends ArrayList<E> {
	
	public ArrayListMap() {
		super();
	}
	
	/**
	 * Makes a new list from objects from a Map.
	 * @param properties The map with the objects
	 * @param size The amount of objects in the map. Used if the map contains more items.
	 */
	public ArrayListMap(Map<String, Object> properties, long size) {
    	super();
		
    	for(int i = 0; i < size; i++) {
    		this.add((E) properties.get("" + i));
    	}
    }
	
	/**
	 * Returns a Map with the objects of this list.
	 * @return A Map with the values of this list.
	 */
	public HashMap<String, E> getProperties() {
    	HashMap<String,E> properties = new HashMap<String,E>();
    	
    	for(int i = 0; i < this.size(); i++) {
    		properties.put("" + i, this.get(i));
    	}
    	
    	return properties;
    }
	
	
}
